<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta http-equiv="pragma" content="no-cach" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />

<title>无标题文档</title>
<style>
body{margin:0px;  }
li{list-style-type:hiragana;}
@font-face {
				font-family: 'inconsolata';
				src: url('../inc/inconsolata.woff') format('woff');
				font-weight: normal;
				font-style: normal;
			}

</style>
<script src="../inc/tools.build.js" type="text/javascript"></script>
<script src="../o/jquery-2.1.1.js"></script>
<script src="./webglJS/main.js?a=<?php echo rand(0,999999);?>"></script>
<script>
 
</script>
 

<?php
/*fileName: 
 *internal version: 0001
 *version : 1.0.0 [programming] [official version]
 *author : HeShengyu
 *Date : 2014.07.21 
 *email: koolfer@163.com
 *end date:2014.08.23
 *http://www.cnblogs.com/ssnowy/
*/
?>

</head>
<body>
<?php
 
require_once 'appInc.php';
function _formatNum($a){
if($a<10){return "0000".$a;}	
if($a<100){return "000".$a;}	
if($a<1000){return "00".$a;}	
if($a<10000){return "0".$a;}	
if($a<100000){return "".$a;}	
}

function sgbk2utf($string) {
	if(is_array($string)) {
		foreach($string as $key => $val) {
			 $string[$key] = sgbk2utf($val);		 
		}
	} else {
	$string =iconv('GBK//IGNORE','UTF-8//IGNORE',$string);;
	}
	return $string;
}
$scan = new Clscandir('I:/VDownload/');
$files=$scan->getFiles_match('/.flv$/');
$tab = new Cltable;
$tab->export(  array(count(sgbk2utf($files)) )  );
$path =$scan->path ;
if(isset($_REQUEST['id'])){
$id=preg_replace("[^0-9]","",$_REQUEST['id']);
}else{
$id= 0;
	
}
echo $id."<br>";
 if(!file_exists('I:/VDownload/new/' )){
 mkdir('I:/VDownload/new/',0777);	 
 }
 _exec($files,$path,$id);
 
function _exec($arr,$path,$id){
	$pageSize = 1;
    $len = count($arr);
	$end = $id + $pageSize;
	if($end>$len-1){
		$end= $len-1;
	}
	for($i=$id+1;$i<=$end+1;$i++){
		$v= $arr[$id];
		$comName = $path.($v);
		//$newName = $path."new/ID"._formatNum($id)."_".preg_replace(array("/[\x7f-\xff]/","/\s+/"),array("","-s-"),$v);
		$newName = $path."new/ID"._formatNum($id)."_".preg_replace(array( "/&/","/\s+/")
		,array("-26." ,"-s."),$v);
		//alert(encodeURIComponent('&'))
		echo sgbk2utf($comName)."---><br>";
		echo sgbk2utf($newName)."<br>";
		echo copy($comName,$newName)?"ok":"failed" ;
		//if($i<$end-1){
		echo "<script>
		window.setTimeout(function(){
			window.location='?id=".($id+$pageSize)."&r=".rand(100000,999999)."'
			},10);
		</script>";
		//}else{
		//    echo '全部转码完毕';	
		//}
				
	}	
}
/*exec('___FLV__ExtractVid.bat',$r,$b);
secho(sgbk2utf($r));

exec('___FLV_ExtractAudio.bat',$r2,$b);
secho(sgbk2utf($r2));

//exec('___FLV___MixMp4.bat',$r3,$b);
//secho(sgbk2utf($r3));

 exec('mp4box.exe -add flv/video.mp4     -add  flv/audio.aac      -new flv/Flv2Mp4_outMIX-.mp4',$r3,$b);
 secho(sgbk2utf($r3));*/
 
?> 
<div id="id1"></div>
</body>
</html>